package com.moonstar.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Arrays;
import java.util.List;


/***
 *
 * @Description: 用户登录拦截器配置
 * @author:
 */
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    private static final List<String> EXCLUDE_PATH = Arrays.asList("/","/login","/reg","/file/**","/static/**");

    @Override
    public void addInterceptors(InterceptorRegistry registry)  {
        //注册TestInterceptor拦截器
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").excludePathPatterns(EXCLUDE_PATH);
    }
}
